package com.yinxin.thread.state;

import com.yinxin.util.ThreadUtil;

/**
 * @author yinxin
 * @Title:
 * @Package
 * @Description: 类似于插队，但具体怎么去执行看cpu
 * @date 2022/1/715:49
 */
public class TestJoin implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            ThreadUtil.sleep(100);
            System.out.println("线程vip来了"+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();
        for (int i = 0; i < 100; i++) {
            ThreadUtil.sleep(100);
            if(i==50){
                thread.join();
            }
            System.out.println("main....."+i);
        }
    }
}
